// VitePress主题配置文件
// 集成Element Plus和自定义组件

import DefaultTheme from 'vitepress/theme'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import TableViewer from '../components/TableViewer.vue'
import TypeViewer from '../components/TypeViewer.vue'
import CopyButton from '../components/CopyButton.vue'
import CodeBlock from '../components/CodeBlock.vue'
import { marked } from 'marked'
import './custom.css'

export default {
    ...DefaultTheme,
    enhanceApp({ app }) {
        app.use(ElementPlus)

        // 注册全局组件
        app.component('TableViewer', TableViewer)
        app.component('TypeViewer', TypeViewer)
        app.component('CopyButton', CopyButton)
        app.component('CodeBlock', CodeBlock)

        // 配置marked库
        marked.setOptions({
            breaks: true,  // 允许换行
            gfm: true,     // 启用GitHub Flavored Markdown
            headerIds: true, // 为标题生成ID
            mangle: false  // 不转义HTML标记
        })
    }
} 